/**
 * @description: dingtalk.robot.webapi参数校验
 * @version: 0.0.1
 * @author: z..
 * @Date: 2023-06-08 14:07:35
 */

import { Rule, RuleType } from '@midwayjs/validate';
import { requiredNumber, requiredString, requiredObject,requiredAny, PageDTO } from "./common";

// 新增参数校验
export class CreateWebapiDTO {
  @Rule(requiredString)
  webapiName: string;
  @Rule(RuleType.string())
  webapiContent: string;
  @Rule(requiredString)
  webapiType: string;
  @Rule(requiredString)
  webapiEndtime: string;
  @Rule(requiredAny)
  webapiUserid: any;
  @Rule(requiredObject)
  webapiConfig: object;
  @Rule(RuleType.number())
  brandId: number;
  @Rule(RuleType.string())
  brandName: string;
  @Rule(RuleType.number())
  projectId: number;
  @Rule(RuleType.string())
  projectName: string;
  @Rule(requiredNumber)
  testingInterval: number;
  @Rule(RuleType.number())
  sendSuccessMsg: number;
  @Rule(requiredString)
  webapiMethod: string;
  @Rule(requiredString)
  webapiDomain: string;
  @Rule(RuleType.any())
  webapiPath: any;
  @Rule(RuleType.string())
  webapiCheck: string;
  @Rule(requiredObject)
  webapiData: object;
  @Rule(requiredString)
  webapiClass: string;
}

//  更新参数校验
export class UpdateWebapiDTO extends CreateWebapiDTO {
  @Rule(requiredNumber)
  id: number;
}

// 分页查询参数校验
export class GetWebapiPageDTO extends PageDTO {
  @Rule(RuleType.any())
  webapiStatus: any;
  @Rule(RuleType.any())
  testingStatus: any;
  @Rule(RuleType.any())
  filterDateType: any;
  @Rule(RuleType.any())
  filterDate: any;
}
// 更新状态参数校验
export class UpdateWebapiStatusDTO {
  @Rule(requiredNumber)
  id: number;
  @Rule(requiredString)
  webapiStatus: string;
}
